#include<iostream>
using namespace std;

template<typename T>
auto sum_fac(T f)
{
    auto res = [f](int a, int b)
    {
        auto r=0;
        for(int i = a;i<b;++i)
        {
            r+=f(i);
        }
        return r;
    };
    return res;
}

int main(int argc, char const *argv[])
{
    auto sum_int = sum_fac([](auto x){return x;});
    cout<<sum_int(1,100)<<"\n";
    return 0;
}
